package com.zhangjinghao.service.impl;

import com.zhangjinghao.entity.Desire;
import com.zhangjinghao.mapper.DesireMapper;
import com.zhangjinghao.mapper.MiddleMapper;
import com.zhangjinghao.service.DesireService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DesireServiceImpl implements DesireService {

    @Autowired
    private DesireMapper desireMapper;
    @Autowired
    private MiddleMapper middleMapper;

    @Override
    public List<Desire> selectList() {

        return desireMapper.selectList();
    }

    @Override
    public int insert(Desire desire) {
        return desireMapper.insert(desire);
    }

    @Override
    public Desire selectById(Integer id) {
        return desireMapper.selectById(id);
    }

    @Override
    public int update(Desire desire) {
        return desireMapper.update(desire);
    }

    @Override
    public int delete(Integer id) {
        middleMapper.delete(id.toString());
        return desireMapper.delete(id);
    }
}
